<template>
  <section class="achievement">
    <div v-if="isAdmin" class="desc">请登录学生或教师账户</div>
    <teacher v-if="isTeacher" />
    <student v-if="isStudent" />
  </section>
</template>
<script>
import Student from "./student/index";
import Teacher from "./teacher/index";

export default {
  name: "Achievement",
  data() {
    return {
      isTeacher: false,
      isStudent: false,
      isAdmin: false,
    };
  },
  components: { Student, Teacher },
  created() {
    this.judgmentAuthority();
  },
  methods: {
    judgmentAuthority() {
      this.$store.getters.roles.map((r) => {
        if (r == "teacher") return (this.isTeacher = true);
        if (r == "student") return (this.isStudent = true);
        if (r == "admin") return (this.isAdmin = true);
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.achievement {
  .desc {
    padding: 20px;
    text-align: center;
    font-weight: 700;
    color: red;
  }
}
</style>
